package cn.wcy.design_patterns.test.Controller.demo1;


import org.springframework.util.StringUtils;

import java.util.HashMap;
import java.util.Map;


class Factory {

    private static Map<String, AbstractHandler> strategyMap = new HashMap<>();

    public static AbstractHandler getInvokeStrategy(String name) {
        return strategyMap.get(name);
    }

    //表驱动
    public static void register(String name, AbstractHandler handler) {
        if (StringUtils.isEmpty(name) || null == handler) {
            return;
        }
        strategyMap.put(name, handler);
    }
}